Use DEFINE_SPINLOCK consistently throughout Xen.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 1 Jun 2006 20:49:25 +0000 (21:49 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 1 Jun 2006 20:49:25 +0000 (21:49 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
14 files changed:
xen/arch/x86/cpu/mtrr/main.c
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/i8259.c
xen/arch/x86/microcode.c
xen/arch/x86/smp.c
xen/arch/x86/time.c
xen/arch/x86/x86_32/domain_page.c
xen/common/dom0_ops.c
xen/common/page_alloc.c
xen/common/perfc.c
xen/common/trace.c
xen/common/xmalloc.c
xen/drivers/char/console.c
xen/include/xen/console.h

index 4737caf8aa494933e27d9f1a5e317d3871324ff2..5684d40c89d78e39d18e3b6e9391894636a4c201 100644 (file)
@@ -43,7 +43,7 @@
 #include "mtrr.h"
 
 /* No blocking mutexes in Xen. Spin instead. */
-#define DECLARE_MUTEX(_m) spinlock_t _m = SPIN_LOCK_UNLOCKED
+#define DECLARE_MUTEX(_m) DEFINE_SPINLOCK(_m)
 #define down(_m) spin_lock(_m)
 #define up(_m) spin_unlock(_m)
 #define lock_cpu_hotplug() ((void)0)
index 561ca00a79e667dd1361e3100df65a00bac4a340..4e4c4f568ed3ff2b40392537b5bcb82330a51944 100644 (file)
@@ -84,28 +84,26 @@ struct svm_percore_globals svm_globals[NR_CPUS];
 /*
  * Initializes the POOL of ASID used by the guests per core.
  */
-void asidpool_init( int core )
+void asidpool_init(int core)
 {
     int i;
-    svm_globals[core].ASIDpool.asid_lock = SPIN_LOCK_UNLOCKED;
-    spin_lock(&svm_globals[core].ASIDpool.asid_lock);
+
+    spin_lock_init(&svm_globals[core].ASIDpool.asid_lock);
+
     /* Host ASID is always in use */
     svm_globals[core].ASIDpool.asid[INITIAL_ASID] = ASID_INUSE;
-    for( i=1; i<ASID_MAX; i++ )
-    {
+    for ( i = 1; i < ASID_MAX; i++ )
        svm_globals[core].ASIDpool.asid[i] = ASID_AVAILABLE;
-    }
-    spin_unlock(&svm_globals[core].ASIDpool.asid_lock);
 }
 
 
 /* internal function to get the next available ASID */
-static int asidpool_fetch_next( struct vmcb_struct *vmcb, int core )
+static int asidpool_fetch_next(struct vmcb_struct *vmcb, int core)
 {
     int i;   
-    for( i = 1; i < ASID_MAX; i++ )
+    for ( i = 1; i < ASID_MAX; i++ )
     {
-        if( svm_globals[core].ASIDpool.asid[i] == ASID_AVAILABLE )
+        if ( svm_globals[core].ASIDpool.asid[i] == ASID_AVAILABLE )
         {
             vmcb->guest_asid = i;
             svm_globals[core].ASIDpool.asid[i] = ASID_INUSE;
index 17bab16f9c04a61b69dff1582898125975841625..76c47b559235afba1f48b1bfbba55a295b12faae 100644 (file)
@@ -102,7 +102,7 @@ BUILD_SMP_INTERRUPT(thermal_interrupt,THERMAL_APIC_VECTOR)
  * moves to arch independent land
  */
 
-spinlock_t i8259A_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(i8259A_lock);
 
 static void disable_8259A_vector(unsigned int vector)
 {
index 2e31eea4802a495119f41d042217fc8f5d07dbc2..d1b185e1681a9d22a7a15475f92dc9afd15afff6 100644 (file)
@@ -83,7 +83,7 @@
 #include <asm/processor.h>
 
 #define pr_debug(x...) ((void)0)
-#define DECLARE_MUTEX(_m) spinlock_t _m = SPIN_LOCK_UNLOCKED
+#define DECLARE_MUTEX(_m) DEFINE_SPINLOCK(_m)
 #define down(_m) spin_lock(_m)
 #define up(_m) spin_unlock(_m)
 #define vmalloc(_s) xmalloc_bytes(_s)
index 590e35921ed329b13afdaf1f0dbb999c1aae0058..d56440d8e6f540d1e311d724fd3973ba39aab09e 100644 (file)
@@ -161,7 +161,7 @@ void send_IPI_mask_phys(cpumask_t mask, int vector)
     local_irq_restore(flags);
 }
 
-static spinlock_t flush_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(flush_lock);
 static cpumask_t flush_cpumask;
 static unsigned long flush_va;
 
index 85f52f4d753b20fa8c97b8c61dd899471464507b..54a3ce41d4101d4ed36a21c6136358a69178c057 100644 (file)
@@ -40,10 +40,10 @@ boolean_param("hpet_force", opt_hpet_force);
 
 unsigned long cpu_khz;  /* CPU clock frequency in kHz. */
 unsigned long hpet_address;
-spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(rtc_lock);
 unsigned long volatile jiffies;
 static u32 wc_sec, wc_nsec; /* UTC time at last 'time update'. */
-static spinlock_t wc_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(wc_lock);
 
 struct time_scale {
     int shift;
@@ -67,7 +67,7 @@ static struct cpu_time cpu_time[NR_CPUS];
 static s_time_t stime_platform_stamp;
 static u64 platform_timer_stamp;
 static struct time_scale platform_timer_scale;
-static spinlock_t platform_timer_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(platform_timer_lock);
 static u64 (*read_platform_count)(void);
 
 /*
index 243a81fac55a1800366e658b71dd9f8c5de9eff5..4a7362d7e23c11de6e1078b2a918d6bb7681b111 100644 (file)
@@ -183,7 +183,7 @@ void mapcache_init(struct domain *d)
 static unsigned long inuse[BITS_TO_LONGS(GLOBALMAP_BITS)];
 static unsigned long garbage[BITS_TO_LONGS(GLOBALMAP_BITS)];
 static unsigned int inuse_cursor;
-static spinlock_t globalmap_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(globalmap_lock);
 
 void *map_domain_page_global(unsigned long pfn)
 {
index 49bb47840b803a7902e796c7e5548560ab2f8a41..56c18471015318b84c186b6fe0fbda0482244ea8 100644 (file)
@@ -95,7 +95,7 @@ long do_dom0_op(XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op)
     long ret = 0;
     struct dom0_op curop, *op = &curop;
     void *ssid = NULL; /* save security ptr between pre and post/fail hooks */
-    static spinlock_t dom0_lock = SPIN_LOCK_UNLOCKED;
+    static DEFINE_SPINLOCK(dom0_lock);
 
     if ( !IS_PRIV(current->domain) )
         return -EPERM;
index ab5cd1298a10f08e1c59a84159eef10d35d71a16..55fc27a5a3fa0ac141b8be199b437fff056ae6e4 100644 (file)
@@ -59,7 +59,7 @@ custom_param("lowmem_emergency_pool", parse_lowmem_emergency_pool);
 #define round_pgdown(_p)  ((_p)&PAGE_MASK)
 #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
 
-static spinlock_t page_scrub_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(page_scrub_lock);
 LIST_HEAD(page_scrub_list);
 
 /*********************
@@ -250,7 +250,7 @@ static struct list_head heap[NR_ZONES][MAX_ORDER+1];
 
 static unsigned long avail[NR_ZONES];
 
-static spinlock_t heap_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(heap_lock);
 
 void end_boot_allocator(void)
 {
index df63c1042bbd1d17593394deaf96821febaff979..830e1876b505d8e7afe98c8030916edb2bfd2df6 100644 (file)
@@ -209,7 +209,7 @@ static int perfc_copy_info(XEN_GUEST_HANDLE(dom0_perfc_desc_t) desc)
 /* Dom0 control of perf counters */
 int perfc_control(dom0_perfccontrol_t *pc)
 {
-    static spinlock_t lock = SPIN_LOCK_UNLOCKED;
+    static DEFINE_SPINLOCK(lock);
     u32 op = pc->op;
     int rc;
 
index 6a7827299aba072b2ccbb25fa37ece2e4dff22c6..7e480d0bb402e9acfb9ca5f16ed5ac3f3d199412 100644 (file)
@@ -173,7 +173,7 @@ void init_trace_bufs(void)
  */
 int tb_control(dom0_tbufcontrol_t *tbc)
 {
-    static spinlock_t lock = SPIN_LOCK_UNLOCKED;
+    static DEFINE_SPINLOCK(lock);
     int rc = 0;
 
     spin_lock(&lock);
index 038303960f4f1f68c4944dab44044a9670766b99..019bf9987a0abf1514115a18b614b4c5f054eeed 100644 (file)
@@ -35,7 +35,7 @@
 #include <xen/prefetch.h>
 
 static LIST_HEAD(freelist);
-static spinlock_t freelist_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(freelist_lock);
 
 struct xmalloc_hdr
 {
index 12104c1e3cc24a0a4c0c06b31f958aca24ddff9d..f3a547038e706fb71227e8badb14d084ef7e2308 100644 (file)
@@ -53,7 +53,7 @@ static char printk_prefix[16] = "";
 static int sercon_handle = -1;
 static int vgacon_enabled = 0;
 
-spinlock_t console_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(console_lock);
 
 /*
  * *******************************************************
@@ -563,7 +563,7 @@ static char        *debugtrace_buf; /* Debug-trace buffer */
 static unsigned int debugtrace_prd; /* Producer index     */
 static unsigned int debugtrace_kilobytes = 128, debugtrace_bytes;
 static unsigned int debugtrace_used;
-static spinlock_t   debugtrace_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(debugtrace_lock);
 integer_param("debugtrace", debugtrace_kilobytes);
 
 void debugtrace_dump(void)
@@ -675,7 +675,7 @@ void panic(const char *fmt, ...)
     va_list args;
     char buf[128];
     unsigned long flags;
-    static spinlock_t lock = SPIN_LOCK_UNLOCKED;
+    static DEFINE_SPINLOCK(lock);
     extern void machine_restart(char *);
     
     debugtrace_dump();
index aa93eb32ad08f57b36cdeee41eeb0464c5ff5fc7..b7232f305fcfa767b1f6ab63c132b074ecb7b596 100644 (file)
@@ -10,8 +10,6 @@
 #include <xen/spinlock.h>
 #include <xen/guest_access.h>
 
-extern spinlock_t console_lock;
-
 void set_printk_prefix(const char *prefix);
 
 long read_console_ring(XEN_GUEST_HANDLE(char), u32 *, int);